#!/usr/bin/ksh

### Script pour envoyer des Email depuis Unix ###
### K_Pharos                                    #
# use ./send_mail.sh DEST FILE                  #
#################################################

EXP=$(whoami)
DEST=$1
OBJ="Mail de test"
FILE=$2
FILNAME=$2

# Function send
send()
{
        # Function sendmail
        print "From: ${EXP}"
        print "To: ${DEST}"
        print "Reply-to: ${EXP}"
        print "Subject: ${OBJ}"
        print "X-MSMail-Priority: High"
        print "importance: 1"
        print "Mime-Version: 1.0"
        print "Content-Type: text/plain"
        uuencode $FILE $FILNAME
}

# Appel de la function et envoi de mail.
send | sendmail -t -oi

